#include <bits/stdc++.h>
// 2025/02/07
// tag: 
// Author: Zhang Muen
using namespace std;

using int64 = int64_t;

int64 n, q, d[1000001], k[1000001];
int64 dp[1000001], st[1000001];

int64 Help(int x){
    memset(dp, 0x3f, sizeof(dp));
    dp[1] = 0;
    int top = 0;
    deque<int64> q;
    q.push_back(1);
    for (int i = 2; i <= n; i++) {
        while (!q.empty() && i - q.front() > d[x])
            q.pop_front();
        int j = q.front();
        dp[i] = dp[j] + bool(k[j] <= k[i]);
        if (q.size() > 1)
            q.pop_front(), dp[i] = min(dp[i], dp[q.front()] + bool(k[q.front()] <= k[i])), q.push_front(j);
        while (!q.empty() && (dp[q.back()] > dp[i] || dp[q.back()] == dp[i] && k[q.back()] <= k[i]))
            q.pop_back();
        q.push_back(i);
    }
    return dp[n];
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> k[i];
    cin >> q;
    for (int i = 1; i <= q; i++)
        cin >> d[i];
    for (int i = 1; i <= q; i++)
        cout << Help(i) << endl;
    return 0;
}